\subsection{Quaternions}
We have already seem all the possibilities of groups of order less than 8.
For order 8, we need to first define a new group.
\begin{definition}
	Consider the subset of matrices of \(GL_2(\mathbb C)\) given by
	\[
		\vb 1 = \begin{pmatrix}
			1 & 0 \\ 0 & 1
		\end{pmatrix};\quad \vb i = \begin{pmatrix}
			i & 0 \\ 0 & -i
		\end{pmatrix};\quad \vb j = \begin{pmatrix}
			0 & 1 \\ -1 & 0
		\end{pmatrix};\quad \vb k = \begin{pmatrix}
			0 & i \\ i & 0
		\end{pmatrix}
	\]
	We can form a group from these matrices.
	The set \(\{ \pm \vb 1, \pm \vb i, \pm \vb j, \pm \vb k \}\) forms a group with respect to matrix multiplication known as the quaternions, denoted \(Q_8\).
	The elements therefore satisfy
	\begin{itemize}
		\item \(g^4 = \vb 1\)
		\item \((-\vb 1)^2 = \vb 1\)
		\item \(\vb i^2 = \vb j^2 = \vb k^2 = -\vb 1\)
		\item \(\vb i \vb j = \vb k; \vb j \vb k = \vb i; \vb k \vb i = \vb j\)
		\item \(\vb j \vb i = -\vb k; \vb k \vb j = -\vb i; \vb i \vb k = -\vb j\)
	\end{itemize}
\end{definition}

\subsection{Elements of order 2}
\begin{lemma}
	If a finite group has all non-identity elements of order 2, then it is isomorphic to \(C_2 \times C_2 \times \dots \times C_2\).
\end{lemma}
\begin{proof}
	By question 7 on example sheet 1, we already know that such a \(G\) must be abelian, and that \(\abs{G} = 2^n\).
	If \(\abs{G} = 2\), then \(G \cong C_2\).
	If \(\abs{G} > 2\), then we can choose some element \(a_1\) of order 2, and then there exists another element \(a_2 \notin \genset{a_1}\) of order 2.
	By the Direct Product Theorem, \(\genset{a_1, a_2} \cong \genset{a_1} \times \genset{a_2}\).
	We can repeat this direct product with elements not in the group to generate the whole group.
\end{proof}

\subsection{Classification of groups of order 8}
\begin{theorem}
	A group of order 8 is isomorphic to exactly one of:
	\begin{itemize}
		\item \(C_8\)
		\item \(C_4 \times C_2\)
		\item \(C_2 \times C_2 \times C_2\)
		\item \(D_8\)
		\item \(Q_8\)
	\end{itemize}
\end{theorem}
\begin{proof}
	Firstly, the above groups are not isomorphic: \(C_8, C_4 \times C_2, C_2 \times C_2 \times C_2\) are all abelian while \(D_8\) and \(Q_8\) are not.
	The abelian groups can be distinguished by the maximal order of an element.
	The non-abelian groups can be distinguished by the number of elements of order 2.
	\(D_8\) has \(s\), \(r^2\), \(r^2s\), while \(Q_8\) only has \(-\vb 1\).

	Now let \(G\) be a group such that \(\abs{G} = 8\).
	If \(g \in G\), then \(o(g) \mid 8\) by Lagrange's Theorem.
	So \(o(g) = 1, 2, 4, 8\).
	\begin{itemize}
		\item If there is an element of order 8, then \(G = \genset{g} \cong C_8\).
		\item If all non-identity elements have order 2, then \(G = C_2 \times C_2 \times C_2\) by the above lemma.
		\item The remaining cases are when there are no elements of order 8, and not all elements are of order 2, so there exists some element \(h\) of order 4.
		      Note then that \(\genset{h} \cong C_4\) and \(\abs{G:\genset{h}} = 2\), so \(\genset{h} \trianglelefteq G\).
		      Thus, \(g^2 \in \genset h\) by question 4 on example sheet 3.
		      So \(g^2 = e, h, h^2, h^3\).

		      Now, consider \(ghg^{-1}\).
		      This must lie in \(\genset{h}\) since \(\genset{h} \trianglelefteq G\), and must have order 4 since \(h\) does.
		      So \(ghg^{-1} = h, h^3\).
		      We will now consider each possible case of \(g^2\) together with each possible case of \(ghg^{-1}\).
		      \begin{itemize}
			      \item If \(g^2 = h, h^3\) then \(g^4 = h^2 \neq e\) so \(g\) has order 8 \contradiction.
			            So either \(g^2 = e\) or \(g=h^2\).
			      \item If \(g^2 = e\):
			            \begin{itemize}
				            \item If \(ghg^{-1} = h\), then \(gh = hg\), so \(g\) and \(h\) commute.
				                  Further, \(\genset{h} \cap \genset{g} = \{ e \}\), and \(G = \genset{h} \cdot \genset{g}\).
				                  By the Direct Product Theorem, \(G \cong \genset{h} \times \genset{g} = C_4 \times C_2\).
				            \item If \(ghg^{-1} = h^3 = h^{-1}\), then since \(g^2 = e\), we recognise that the group is the dihedral group \(D_8\) with \(h=r\), \(g=s\).
			            \end{itemize}
			      \item If \(g^2 = h^2\) (note that this does not necessarily imply that \(g=h\)), we will have
			            \begin{itemize}
				            \item If \(ghg^{-1} = h\), then \(g\) and \(h\) commute, so \((gh)^2 = g^2h^2 = h^2h^2 = e\).
				                  So \(gh\) has order 2.
				                  We can again apply the direct product theorem to \(\genset{h} \cong C_4\) and \(\genset{gh} \cong C_2\), and we get \(g \cong \genset{h} \times \genset{g} \cong C_4 \times C_2\) again.
				            \item If \(ghg^{-1} = h^3 = h^{-1}\), then we can define a map
				                  \[
					                  \varphi \colon G \to Q_8
				                  \]
				                  by
				                  \begin{align*}
					                  e   & \mapsto \vb 1  & g    & \mapsto \vb j  \\
					                  h   & \mapsto \vb i  & gh   & \mapsto -\vb k \\
					                  h^2 & \mapsto -\vb 1 & gh^2 & \mapsto -\vb j \\
					                  h^3 & \mapsto -\vb i & gh^3 & \mapsto \vb k
				                  \end{align*}
				                  Clearly \(\varphi\) is bijective, and we can check that it is a homomorphism.
				                  So it is an isomorphism, so \(G \cong Q_8\).
			            \end{itemize}
		      \end{itemize}
	\end{itemize}
\end{proof}
\begin{remark}
	We know that in an abelian group, every subgroup is normal.
	The converse is not true.
	Just because every subgroup is normal, this does not mean that the group is abelian.
	For example \(Q_8\) is an example, where its subgroups are \(\genset{\vb i}\), \(\genset{\vb j}\), \(\genset{\vb k}\) (which are normal since they have index 2), and \(\genset{-\vb 1}\) which is normal since it commutes with everything.
\end{remark}
